﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Application;
using Traceability.App.Application.Dto.Input;
using Traceability.App.Application.Dto.Output;
using Traceability.App.Domain.Model;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ImgController : ControllerBase
    {
        private readonly IService service;
        public ImgController(IService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 添加图片
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddImg(ImageModel model) 
        {
            return service.AddImg(model);
        }
        /// <summary>
        /// 删除图片
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpDelete]
        public ApiResult<int> DelImg(DelImgInput input) 
        {
            return service.DelImg(input);
        }
        /// <summary>
        /// 获取图片
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<ImageModel>> GetImageShow([FromQuery]ImageOutput output) 
        {
            return service.GetImageShow(output);
        }
    }
}
